// store.js
import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

const store = new Vuex.Store({
  state: {
    webSocketMsg: '', // 患者信息
    accpectPatientMsg: '', // 接收患者发送的信息
    joinInquiryPatient: '', // 加入房间信息
    webSocketMsgRemoteMsg: '', // 远程会诊的消息
    // 当前患者个人信息
    remotePatientInfo: {

    },
    remoteId: localStorage.getItem('remoteId') || '',
  },

  mutations: {
    SET_REMOTE_ID(state, id) {
      state.remoteId = id;
      localStorage.setItem('remoteId', id);
    },
    setRemotePatientInfo(state, info) {
      state.remotePatientInfo = info;
    },
    webSocketMsg(state, msg) {
      console.log(state, msg, 'webSocketMsg');
      state.webSocketMsg = msg;
    },
    webSocketMsgRemote(state, msg) {
      state.webSocketMsgRemoteMsg = msg;
    },
    accpectPatientMsg(state, msg) {
      // console.log(state,msg,'accpectPatientMsg')
      state.accpectPatientMsg = msg;
    },
    joinInquiryPatient(state, msg) {
      // console.log(state,msg,'joinInquiryPatient')
      state.joinInquiryPatient = msg;
    },
  },
});

export default store;
